package com.example.demo.nio;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * <内容说明>
 *
 * @author yu.guangqi
 * created on 2018/11/8 15:46
 */
public class FileCopyByIO {

    public static void main(String[] args) throws Exception {

        FileInputStream fis = new FileInputStream("E:\\IntelliJ IDEA 2017.2.5\\workplaces\\netty-demo\\src\\main\\java\\com\\example\\demo\\nio\\document\\a" +
                ".txt");

        FileOutputStream fos = new FileOutputStream("E:\\IntelliJ IDEA " +
                "2017.2.5\\workplaces\\netty-demo\\src\\main\\java\\com\\example\\demo\\nio\\document\\c.txt");

        byte[] bytes = new byte[10];
        int readBytes = 0;
        while ((readBytes = fis.read(bytes)) > 0) {
            System.out.println("readBytes:" + readBytes);
            fos.write(bytes, 0, readBytes);
        }

        fis.close();
        fos.close();
    }
}
